from django.db import models
from .categoryModel import Category


class Product(models.Model):
    category = models.ForeignKey(to=Category, verbose_name='分类id', on_delete=models.SET_NULL, null=True)
    masterName = models.CharField(max_length=50, default='商品', verbose_name='商品名称')
    slaveName = models.CharField(max_length=100, default='xxx', verbose_name='商品描述')
    inventory = models.IntegerField(default=0, verbose_name='库存')
    maxPrice = models.DecimalField(max_digits=8, decimal_places=2, default=0.00, verbose_name='最高价格')
    minPrice = models.DecimalField(max_digits=8, decimal_places=2, default=0.00, verbose_name='最低价格')
    banners = models.CharField(max_length=500, default='abc.png', verbose_name='轮播图图片')
    # 字符太多了, 换成TextField
    # descPics = models.CharField(max_length=1200, default='abc.png', verbose_name='产品详情图片')
    descPics = models.TextField(default='')

    class Meta:
        db_table = 'zz_Product'
